<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('系统通告列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>标题：</label>
                                <input type="text" name="titile"/>
                            </li>
                            <li>
                                <label>发布人：</label>
                                <input type="text" name="sender"/>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/message";

        $(function() {
            var options = {
                url: prefix + "/list",
                detailUrl: prefix + "/detail/{id}",
                modalName: "消息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id', 
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'title',
                    title: '标题'
                },
                {
                    field: 'sender', 
                    title: '发布人'
                },
                {
                    field: 'readStatus',
                    title: '阅读状态',
                    formatter: function(value, item, index) {
                        if (value === '0') {
                            return '<span class="label label-danger">未读</span>';
                        }
                        else {
                            return '<span class="label label-success">已读</span>';
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return '<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>查看</a>';
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>